package ifpb.monteiro.p2.projetoFinal;

import java.io.IOException;
import java.io.OutputStream;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.Socket;
import java.net.SocketException;
import java.net.UnknownHostException;

public class BroadcastCliente {

	/**
	 * @param args
	 * @throws IOException
	 * @throws UnknownHostException
	 */
	
	public BroadcastCliente() throws IOException{
		
		byte[] receiveData = new byte[100];

		DatagramSocket clientSocket = new DatagramSocket(5000);

		DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length);

		clientSocket.receive(receivePacket);
		String ipServidor = receivePacket.getAddress().toString();
		System.out.println(ipServidor.replace("/", ""));
	}
	public static void main(String[] args) throws IOException {
		new BroadcastCliente();
	}

}
